<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="js/jquery-1.11.0.js"></script>
		<style type="text/css">
		    *{
			   padding: 0px;
			   margin: 0px;
		    }
		    #div1{
		    	width: 230px;
		    	height: 200px;
		    	border: 5px solid red;
		    	background-color: #000000;
		    	overflow: hidden;
		    	position: relative;
		    }
			#div1 li{
				list-style-type: none;
				color: red;
			}
			#div1 .div1_cla1{
				position: absolute;
				top: 0px;
				right: 0px;
				width: 8px;
				height: 196px;
				/*border: 2px solid green;*/
				display: none;
			}
			#div1 .div1_cla1 span{
				position: absolute;
				top: 0px;
				right: 0px;
				width: 8px;
				height: 100px;
				background-color: yellow;
				/*border: 2px solid;*/
			}
		</style>
	</head>
	<body>
		 <div id="div1">
		 	<ul id="ullist">
		 		<li>IOSHDvSDB据SJD不K</li>
		 		<li>dfgb是平均法vS：N在</li>
		 		<li>i哦SHDVHSDJ不；哦</li>
		 		<li>OISHD u v i在山东</li>
		 		<li>I说的话v流宰辅LSDBV</li>
		 		<li>IOSHDLOSHDV基本上定了</li>
		 		<li>IOSHDvSDB据SJD不K</li>
		 		<li>IOSHDvSDB据SJD不K</li>
		 		<li>IOSHDV基本JD不K</li>
		 		<li>IOSH啊热轧着人Z的JD不K</li>
		 		<li>IOSHDvSDB据SJD不K</li>
		 		<li>IOSHDvSDB据SJD不K</li>
		 		<li>IOSHDV基本不KSGv在SDV</li>
		 		<li>IOSHDvSDB据SJD不K</li>
		 		<li>IOSHSG让人G大噶v热啊给</li>
		 		<li>IOSH做啥子人VZ个D不K</li>
		 	</ul>
		 	<div class="div1_cla1">
		 		<span></span>
		 	</div>
		</div>
		<script src="../../js/jquery1.11.0.min.js"></script>
	    <script type="text/javascript">
	    	$(function(){
	    		//滚动条显示隐藏
	    		$('#div1').mouseover(function(){
	    			$(this).find(".div1_cla1").show();
	    		}).mouseout(function(){
	    			$(this).find(".div1_cla1").hide();
	    		});
	    		//滚动条拖动
	    		var spantop = 0;
	    		var anxia = false;
	    		var mousetop = 0;
	    		$('#div1 .div1_cla1 span').mousedown(function(){
	    			spantop = parseInt($(this).css("top"));
//	    			console.log(spantop);
                    anxia = true;
                    mousetop = event.clientY - $('#div1')[0].offsetTop;
//                  console.log(mousetop);
//                  console.log($('#div1')[0].offsetTop);
	    		})
	    		$("#div1").mouseup(function(){
	    			anxia = false;
	    		});
	    		
	    		$("#div1").mousemove(function(){
	    			var $span = $(this).find(".div1_cla1 span");
	    			mousetop1 = event.clientY - $('#div1')[0].offsetTop;
	    			moveH = mousetop1 - mousetop;
	    			if (anxia && moveH >= 0 && moveH <= 100){
	    				$(this).find(".div1_cla1 span").css("top",moveH + "px");
//	    		        spantop = event.clientY;

                        //控制内容滚动
//                      console.log(parseInt($(this).find("ul").css("height")));
                        var moveheight = parseInt($(this).find("ul").css("height")) - 200;
	    			    var mtop = moveH / 196 * moveheight * - 1;
	    			    $(this).find("ul").css("margin-top",mtop + "px");
	    			}
	    		});
	    	});
	    </script>
	</body>
</html>
